package com.surfilter.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.surfilter.service.PhoneService;

@Controller
public class PhoneImportController {
	
	@Autowired
	private PhoneService phoneService;
	
	@RequestMapping("/phoneImport")
	public String phoneImport(Map<String,Object> map) throws Exception{
        return "phoneSYImport";
    }
	
	@RequestMapping("/phoneImport/queryTask/{pageNum}")
    @ResponseBody
    public Object queryTask(@PathVariable String pageNum) throws Exception{
		return phoneService.queryAccountTask(Integer.parseInt(pageNum));
    }
	
	@RequestMapping("/phoneImport/modifyResultPosition/{set_Id}")
	@ResponseBody
	public Object modifyResultPosition(@PathVariable Long set_Id, @RequestBody List<Map<String,String>> points) {
		Map map = new HashMap();
		try {
			long total = phoneService.modifyResultPosition(set_Id, points);
			map.put("result",1);
			map.put("total",total);
//			result = "成功 共构建:" + total + "条数据";
		} catch (Exception e) {
			map.put("result",0);
//			result = "失败";
			e.printStackTrace();
		}
        return map;
    }
}
